package cn.iocoder.yudao.module.acm.dal.mysql.onboardproduceplan;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.acm.controller.admin.onboardproduceplan.vo.OnboardProducePlanPageReqVO;
import cn.iocoder.yudao.module.acm.controller.app.onboardsupplyplan.vo.AppOnboardProducePlanPageReqVO;
import cn.iocoder.yudao.module.acm.dal.dataobject.onboardproduceplan.OnboardProducePlanDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 航机管理-机供品生产计划 Mapper
 *
 * @author yisla
 */
@Mapper
public interface OnboardProducePlanMapper extends BaseMapperX<OnboardProducePlanDO> {

    default PageResult<OnboardProducePlanDO> selectPage(OnboardProducePlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OnboardProducePlanDO>()
                .eqIfPresent(OnboardProducePlanDO::getPlanCode, reqVO.getPlanCode())
                .eqIfPresent(OnboardProducePlanDO::getFlightNo, reqVO.getFlightNo())
                .eqIfPresent(OnboardProducePlanDO::getDepTime, reqVO.getDepTime())
                .eqIfPresent(OnboardProducePlanDO::getStatus, reqVO.getStatus())
                .orderByDesc(OnboardProducePlanDO::getId));
    }

    default PageResult<OnboardProducePlanDO> appSelectPage(AppOnboardProducePlanPageReqVO reqVO) {

        LambdaQueryWrapperX<OnboardProducePlanDO> wrapperX = new LambdaQueryWrapperX<OnboardProducePlanDO>()
                .likeIfPresent(OnboardProducePlanDO::getPlanCode, reqVO.getPlanCode())
                .likeIfPresent(OnboardProducePlanDO::getFlightNo, reqVO.getFlightNo())
                .eqIfPresent(OnboardProducePlanDO::getDepTime, reqVO.getDepTime())
                .eqIfPresent(OnboardProducePlanDO::getStatus, reqVO.getStatus())
                .orderByDesc(OnboardProducePlanDO::getId);
        return selectPage(reqVO, wrapperX);
    }

}